﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PersonalWebsite.Domain.Abstract.Configuration;
using PersonalWebsite.Domain.Entities.Website;

namespace PersonalWebsite.Domain.Configurations.Website;

public class WS_ProExperienceConfiguration : BaseConfiguration<WS_ProExperience>
{
    public override void Configure(EntityTypeBuilder<WS_ProExperience> builder)
    {
        builder.ToTable(nameof(WS_ProExperience));

        builder.Property(c => c.Name).HasComment(comment: "项目名称").IsRequired().HasMaxLength(20);
        builder.Property(c => c.Year).HasComment("年份").IsRequired();
        builder.Property(c => c.Desc).HasComment("项目描述").HasMaxLength(500).IsRequired(true);
        builder.Property(c => c.ImageUrl).IsUnicode(false).HasComment("项目图片").HasMaxLength(1000).IsRequired(true);

        builder.HasIndex(c => c.Year);

        base.Configure(builder);
    }
}